const {
    resolve
} = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')


//设置nodejs环境变量
// process.env.NODE_ENV = 'development'

module.exports = {
    entry: './src/js/index.js',
    output: {
        filename: 'js/built.js',
        path: resolve(__dirname, 'build')
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: './src/index.html'
        }),
    ],
    //生产模式下自动压缩js
    mode: 'production'
}